﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Repository.EntityFramework.Accounts
{
    /// <summary>
    /// TODO:  一条记录应该表示为一次登录的上下文！不使用户Id放到客户端，而是使用上下文的logId放以客户端去。
    /// </summary>
    public class AccountLog //: AggregateRoot
    {
        [System.ComponentModel.DataAnnotations.Key]
        public int Id { get; set; }


        [System.ComponentModel.DataAnnotations.Schema.Index]
        [System.ComponentModel.DataAnnotations.StringLength(128)]
        [System.ComponentModel.DataAnnotations.Required]
        public string AccountId { get; set; }

        [System.ComponentModel.DataAnnotations.StringLength(128)]
        [System.ComponentModel.DataAnnotations.Required]
        public string AccountName { get; set; }

        /// <summary>
        /// 当前登录的唯一标识
        /// </summary>
        [System.ComponentModel.DataAnnotations.Schema.Index/*(IsUnique=true)*/]
        [System.ComponentModel.DataAnnotations.StringLength(128)]
        [System.ComponentModel.DataAnnotations.Required]
        public string SessionId { get; set; }
        
        [System.ComponentModel.DataAnnotations.StringLength(15)]
        [System.ComponentModel.DataAnnotations.Required]
        public string IpAddress { get; set; }


        /// <summary>
        /// 登录时间
        /// </summary>
        public DateTime LogIn { get; set; }

        /// <summary>
        /// 退出时间
        /// </summary>
        public DateTime? LogOff { get; set; }


    }
}
